home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
lspd05_1.zip
/
LSPEED.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-21
|
13KB
|
286 lines
/*
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ L I G H T - S P E E D P R O G R A M M E R S L I B R A R Y │
│ │
│ S U P E R F A S T G R A P H I C S T O O L K I T │
│ │
│ │
│ SOURCE CODE MODULE, COPYRIGHT (C) 1991, ALL RIGHTS RESERVED │
│ │
│ DESIGNED AND PROGRAMMED BY DARREN LYON │
│ │
│ ▄▄ ▄▄ ▄▄ ▄▄▄▄ ▄▄▄▄▄ ▄▄ ▄ ▄ ▄ ▄▄▄ ▄▄▄▄ tm │
│ ██ ▀█▄▄█▀ ██ ▄▄ ▄▄ ▀██ █▄ █▄ ▄█ ▀█ ██ ▄▄▄ │
│ ▀▀ ▀▀ ██ ██ ██ ██ █▄ █▄█ ▄█▀ ▀█ ▀▀█▄ █ │
│ ▀▀▀▀▀ ▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀ ▀ ▀▀▀▀▀▀ ▀ ▀▀▀▀ │
│ │
└───────────────────────────────────────────────────────────────────────────┘*/
/***
*** LIGHT SPEED GRAPHICS LIBRARY
*** FUNCTION INTERFACE HEADER FILE
***/
/* Test for previous inclusion, abort if so */
#ifndef LIGHT_SPEED_GRAPHICS
/* Define our own flag */
#define LIGHT_SPEED_GRAPHICS
/* Colour declarations */
#define LS_BLACK 0
#define LS_BLUE 1
#define LS_GREEN 2
#define LS_CYAN 3
#define LS_RED 4
#define LS_MAGENTA 5
#define LS_BROWN 6
#define LS_LGREY 7 /* Australian/American spelling */
#define LS_LGRAY 7
#define LS_DGREY 8 /* Australian/American spelling */
#define LS_DGRAY 8
#define LS_LBLUE 9
#define LS_LGREEN 10
#define LS_LCYAN 11
#define LS_LRED 12
#define LS_LMAGENTA 13
#define LS_YELLOW 14
#define LS_WHITE 15
/* Global variables - needed in assembly modules as well */
/* _NOT_ C accessable!
extern unsigned int ls_mode; Last mode set (using LSpeed)
extern unsigned int ls_apage; Currently active video page
extern unsigned int ls_vpage; Currently visible video page
extern unsigned int ls_scrcols; Current number of columns
extern unsigned int ls_scrrows; Current number of rows
extern unsigned int ls_page1start; Address of the first page
extern unsigned int ls_page2start; Address of the second page
extern unsigned int ls_bytesline; Number of bytes per line
extern unsigned int ls_originoffset; Offset from the origin
extern unsigned int ls_apagestart; Start address of the active page */
/* C accessable */
extern char ls_registeredfonts[]; /* Fonts active in memory */
extern char ls_fontheights[]; /* Heights of the fonts */
/* Video mode values */
#define EGA_320x200 0x000D;
#define EGA_640x200 0x000E;
#define EGA_640x350 0x0010;
#define EGA_80x25 0x0003;
#define EGA_40x25 0x0001;
/* Font data declarations */
#define BROAD_FONT 1
extern char far *ls_broadfont;
extern char ls_broadfontdata[];
#define COMPUTER_FONT 2
extern char far *ls_computerfont;
extern char ls_computerfontdata[];
#define PLASMA_FONT 3
extern char far *ls_plasmafont;
extern char ls_plasmafontdata[];
#define SMALL_FONT 4
extern char far *ls_smallfont;
extern char ls_smallfontdata[];
#define STANDARD_FONT 5
extern char far *ls_standardfont;
extern char ls_standardfontdata[];
#define TALL_FONT 6
extern char far *ls_tallfont;
extern char ls_tallfontdata[];
#define SCRIPT_FONT 7
extern char far *ls_scriptfont;
extern char ls_scriptfontdata[];
#define NICE_FONT 8
extern char far *ls_nicefont;
extern char ls_nicefontdata[];
#define CRISP_FONT 9
extern char far *ls_crispfont;
extern char ls_crispfontdata[];
#define OLD_ENGLISH_FONT 10
extern char far *ls_oldenglishfont;
extern char ls_oldenglishfontdata[];
#define PLAIN_FONT 11
extern char far *ls_plainfont;
extern char ls_plainfontdata[];
#define ITALIC_FONT 12
extern char far *ls_italicfont;
extern char ls_italicfontdata[];
/* Font size functions */
#define ega_fontheight(fontnum) ls_fontheights[(fontnum)-1]
#define ega_fontwidth(fontnum) (8)
/* Define the mouse buttons */
#define MOUSE_LEFT 1
#define MOUSE_RIGHT 2
#define MOUSE_MIDDLE 3
/* Define the known display types */
#define LS_NODISPLAY 0
#define LS_EGADISPLAY 3
#define LS_CGADISPLAY 4
#define LS_MONODISPLAY 5
#define LS_VGAMONODISPLAY 7
#define LS_VGACOLORDISPLAY 8
/* Define the primary display types */
#define LS_PRIMARY_EGA 1
#define LS_PRIMARY_CGA 2
#define LS_PRIMARY_MONOHERC 3
/* Various button macros */
#define left_button() (while (!mouse_buttons()&1) ;)
#define right_button() (while (!mouse_buttons()&2) ;)
#define middle_button() (while (!mouse_buttons()&3) ;)
#define wait_for_mouse() (while (!mouse_buttons()) ;)
/* Function declarations */
/* Image functions */
void ega_andimage(char far *image, int xloc, int yloc);
int ega_extractsize(char far *image);
void ega_getimage(int topx, int topy, int bottomx, int bottomy, char far *image);
int ega_imagesize(int topx, int topy, int bottomx, int bottomy);
void ega_orimage(char far *image, int xloc, int yloc);
void ega_putimage(char far *image, int xloc, int yloc);
void ega_xorimage(char far *image, int xloc, int yloc);
/* Miscellaneous functions */
void disable_screen(void);
int ega_capture_area_byte(char *filename, int topx, int topy, int bottomx, int bottomy);
int ega_capture_screen_byte(char *filename);
int ega_restore_area_byte(char *filename, int topx, int topy, int bottomx, int bottomy, int xloc, int yloc);
int ega_restore_screen_byte(char *filename);
void enable_screen(void);
unsigned int getxch(void);
void reset_keyboard(void);
/* Mouse functions */
int get_mouse_pos(int *xpos, int *ypos);
int get_mouse_presses(int button, int *presses, int *lastx, int *lasty);
int get_mouse_releases(int button, int *releases, int *lastx, int *lasty);
int hide_mouse(void);
int init_mouse(void);
int mouse_buttons(void);
int mouse_installed(void);
int read_mouse_motions(int *xmotion, int *ymotion);
int set_mouse_pos(int newx, int newy);
int set_mouse_pointer(unsigned int pattern[32], int hotx, int hoty);
int set_mouse_xrange(int leftlimit, int rightlimit);
int set_mouse_yrange(int toplimit, int bottomlimit);
void set_pointer_arrows(void);
void set_pointer_cross(void);
void set_pointer_crosshair(void);
void set_pointer_hand(void);
void set_pointer_hourglass(void);
void set_pointer_pointer(void);
void set_pointer_questionmark(void);
void set_pointer_tick(void);
void set_pointer_watch(void);
int show_mouse(void);
/* Page functions */
void ega_flipapage(void);
void ega_flippage(void);
void ega_flipvpage(void);
int ega_getapage(void);
int ega_getvpage(void);
unsigned int ega_readorigin(void);
void ega_setapage(int page);
void ega_setoffset(char offset);
void ega_setorigin(unsigned int origin);
void ega_setvpage(int page);
/* Status functions */
int display_type(void);
int ega_bytesperline(void);
int ega_displayheight(void);
int ega_displaywidth(void);
int ega_firstpageaddress(void);
int ega_maxscanline(void);
int ega_memory(void);
unsigned char ega_readregister(int regnum);
void ega_retrace(void);
unsigned int ega_secondpageaddress(void);
void ega_writepallete(int paldata[16]);
void ega_writeregister(int regnum, unsigned char value);
int find_primary(void);
int get_mode(void);
int second_adapter(void);
/* Text functions */
int ega_broadch(int character, int xloc, int yloc, int foreground, int background);
int ega_computerch(int character, int xloc, int yloc, int foreground, int background);
int ega_crispch(int character, int xloc, int yloc, int foreground, int background);
int ega_formattext(int xloc, int yloc, int foregrnd, int backgrnd, int font, char *format, ...);
int ega_italicch(int character, int xloc, int yloc, int foreground, int background);
int ega_nicech(int character, int xloc, int yloc, int foreground, int background);
int ega_oldenglishch(int character, int xloc, int yloc, int foreground, int background);
int ega_plainch(int character, int xloc, int yloc, int foreground, int background);
int ega_plasmach(int character, int xloc, int yloc, int foreground, int background);
int ega_scriptch(int character, int xloc, int yloc, int foreground, int background);
int ega_smallch(int character, int xloc, int yloc, int foreground, int background);
int ega_standardch(int character, int xloc, int yloc, int foreground, int background);
int ega_tallch(int character, int xloc, int yloc, int foreground, int background);
void ega_writechar(int character, int xloc, int yloc, int foregrnd, int backgrnd, char far *fontptr);
int ega_writecharacter(int charnum, int xloc, int yloc, int foregrnd, int backgrnd, int font);
void registerbroadfont(void);
void registercomputerfont(void);
void registercrispfont(void);
void registeritalicfont(void);
void registernicefont(void);
void registeroldenglishfont(void);
void registerplainfont(void);
void registerplasmafont(void);
void registerscriptfont(void);
void registersmallfont(void);
void registerstandardfont(void);
void registertallfont(void);
/* Graphics Primitives */
void ega_andcircle(int xloc, int yloc, int radius, int colour);
void ega_andellipse(int xloc, int yloc, int height, int width, int colour);
void ega_andline(int first, int firsty, int secondx, int secondy, int colour);
void ega_andpixel(int xloc, int yloc, int colour);
void ega_andpoly(int colour, ...);
void ega_andrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
void ega_andtriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
void ega_clearpage(void);
void ega_fillarea(int xloc, int yloc, int fillcolour, int bordercolour);
void ega_filledcircle(int xloc, int yloc, int radius, int colour);
void ega_filledellipse(int xloc, int yloc, int height, int width, int colour);
void ega_filledrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
void ega_andtriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
int ega_getpixel(int xloc, int yloc);
void ega_orcircle(int xloc, int yloc, int radius, int colour);
void ega_orellipse(int xloc, int yloc, int height, int width, int colour);
void ega_orline(int first, int firsty, int secondx, int secondy, int colour);
void ega_orpixel(int xloc, int yloc, int colour);
void ega_orpoly(int colour, ...);
void ega_orrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
void ega_ortriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
void ega_putcircle(int xloc, int yloc, int radius, int colour);
void ega_putellipse(int xloc, int yloc, int height, int width, int colour);
void ega_putline(int first, int firsty, int secondx, int secondy, int colour);
void ega_putpixel(int xloc, int yloc, int colour);
void ega_putpoly(int colour, ...);
void ega_putrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
void ega_puttriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
void ega_scanlinefill(int start, int end, int scanline, int colour);
void ega_xorcircle(int xloc, int yloc, int radius, int colour);
void ega_xorellipse(int xloc, int yloc, int height, int width, int colour);
void ega_xorline(int first, int firsty, int secondx, int secondy, int colour);
void ega_xorpixel(int xloc, int yloc, int colour);
void ega_xorpoly(int colour, ...);
void ega_xorrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
void ega_xortriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
void set320x200(void);
void set40x25(void);
void set640x200(void);
void set640x350(void);
void set80x25(void);
#endif